package com.fusion.core.comm.rpc;

import com.fusion.core.comm.Packet;
import com.fusion.core.comm.RPC;
import com.fusion.core.node.Node;

import java.io.IOException;

/**
 * @author SwethaShivakumar 
 * Project: fusion
 * Date: Mar 8, 2009
 * URL: http://fusionwiki.co.cc
 * Mail Me At: shiva@fusionproject.co.cc
 */
public class GetIsFriend extends RPC {
    private Node query;

    public GetIsFriend() {
    }

    public GetIsFriend(Node f) {
        query = f;
    }

    public void execute(Packet data) throws IOException {
        int guid = data.readInt();
        send(new IsFriend(manager.getFriend(guid) != null, guid));
    }

    public Packet serializeTo(Packet p) {
        p.writeInt(query.getGuid());
        return p;
    }
}
